var obj = {
    "name" : "Hugo Hoo",
    "age" : 20,
    "sex" : "male"
}

var JSONText = JSON.stringify(obj);
var elem = document.getElementById("json");
elem.innerText = JSONText;

var obj2 = JSON.parse(JSONText);
alert(obj2.name);
alert(obj2.age);
alert(obj2.sex);